package com.gitee.wsl.android.ui.ext.type

import android.graphics.Point

object PointExt {

    /**
     * Returns the maximum and minimum points of X axis.
     * @param points: List of the points to be drawn.
     */
    fun getMinAndMaxPoints(
        points: List<Point>
    ): Pair<Float, Float> {
        val xMin = points.minOf { it.x }
        val xMax = points.maxOf { it.x }
        return Pair(xMin.toFloat(), xMax.toFloat())
    }

}

fun List<Point>.minAndMaxPoints():Pair<Float, Float> = PointExt.getMinAndMaxPoints(this)